package com.paic.tpa;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.paic.tpa.data.Menu;


@RequestMapping("/menus")
@RestController
public class MenuController {

	@RequestMapping(value = "/{roles}", method = RequestMethod.GET)
    public Menu getMenus(@PathVariable("roles") String roles) {
//        return "Hello2 " + name;
//		return "service 2, menus for role: " + roles;
		Menu m1 = new Menu();
		m1.setId("2");
		m1.setPath("www.baidu.com");
		m1.setName("second menu");
		m1.setComponent("second menu");
		m1.setOrder(20000);
		
		Menu m1sub = new Menu();
		m1sub.setId("2.1");
		m1sub.setPath("www.sina.com.cn");
		m1sub.setName("second sub-menu");
		m1sub.setComponent("second sub-menu");
		m1sub.setOrder(11000);
		
		m1.addChild(m1sub);
		
//		m1.getChildren().add(m1sub);
		
		return m1;
    }
}
